//
//  TOBaseCollectionView.m
//  SeaGullFM
//
//  Created by dllo on 15/11/30.
//  Copyright © 2015年 tianou. All rights reserved.
//

#import "WSBaseCollectionView.h"

@implementation WSBaseCollectionView

- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout
{

    self = [super initWithFrame:frame collectionViewLayout:layout];
    if (self) {
        
        if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"Mode"] isEqualToString:@"night"]) {
            self.backgroundColor = COLOR_NIGHT;
        }
        else
        {
            self.backgroundColor = COLOR_DAY;
        }
    }
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeColor:) name:@"changeColor" object:nil];
    return self;
}
-(void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"changeColor" object:nil];
}

-(void)changeColor:(NSNotification *)notifition
{
    if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"Mode"] isEqualToString:@"night"])
    {
        self.backgroundColor = COLOR_NIGHT;
        
    }
    else
    {
        self.backgroundColor = COLOR_DAY;
    }
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
